package com.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Phillip on 2014/4/15.
 */
public class StringToDate {

    public static java.sql.Date s2d(String string) {

        DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date utilDate = format.parse(string);
            return new java.sql.Date(utilDate.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
}
